<form id = "myForm" action="<?php print url_for('demandes/submitQuestionnaire'); ?>" method="post" enctype="multipart/form-data" >
	<fieldset id="mainFieldSet">
		<legend>Questionnaire</legend>
		<?php foreach ($form as $widget) :?>
			<div id="wrapper_<?php echo $widget->getName();?>">
			<?php if($widget->isHidden()):?>
			<?php 	echo $widget->render()?>
			<?php else:?>
			<?php 	echo $widget->renderRow()?>
			<span class="errorMsg" id="response_msg<?php echo $widget->getName();?>"></span>
			<?php endif;?>
			</div>
		<?php endforeach;?>
		<?php
			include_partial('global/buttons', array('form' => $form,'module' => $module,'className' => $className, 'default'=>$default));
		?>
	</fieldset>
</form>
<script type="text/javascript">
	function getMessageForReponse(id)
	{
		var messages = new Array();
		<?php foreach($form->reponseMessages as $key=>$value): ?>
				messages[<?php echo $key; ?>] = '<?php echo str_replace("'", "\'",$value);?>';
		<?php endforeach; ?>
		return messages[id];
	}
	
	function showReponseMsg(id){
		id_rep = document.getElementById('questionnaire_'+id).value;
		var message = getMessageForReponse(id_rep);
		document.getElementById('response_msg'+id).innerHTML=message;
	}	
</script>

<?php if($questDef->javascript):?>
<script type="text/javascript">
	<?php echo $questDef->javascript;?>
</script>
<?php endif; ?>


